<?php
include '../controllers/getToeflRecommand.php';

date_default_timezone_set("PRC");
$allSets = getAllSets();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="../js/deleteSet.js"></script>
</head>
<body>
<table border='2' rules='rows' cellpadding='8%' align='center'
	width='80%'>
	<tr>
		<th colspan="9">
		<h2>所有IBT机经列表</h2>
		</th>
	</tr>
	<tr>
		<th>机经ID</th>
		<th>机经名称</th>
		<th>更新时间</th>
		<th>听力</th>
		<th>口语</th>
		<th>阅读</th>
		<th>写作</th>
		<th colspan="2">操作</th>
	</tr>
	<?php
	$setCount = count($allSets);
	for ($i = 0; $i < $setCount; $i++) {
			
		$set = $allSets[$i];
		$setId = $set->setId;
		$setName = $set->name;
		$timestamp = $set->timestamp;
		$listening = $set->listening;
		$speaking = $set->speaking;
		$reading = $set->reading;
		$writing = $set->writing;
		$isImportant = $set->isImportant;
		$formatTime = date("y-m-d h:i:s",$timestamp);
		echo "<tr align='center'><td>$setId</td><td>$setName</td><td>$formatTime</td>";
			
		if ($listening == null) {
			echo "<td>无</td>";
		}
		else {
			echo "<td>有</td>";
		}
			
		if ($speaking == null) {
			echo "<td>无</td>";
		}
		else {
			echo "<td>有</td>";
		}
			
		if ($reading == null) {
			echo "<td>无</td>";
		}
		else {
			echo "<td>有</td>";
		}
			
		if ($writing == null) {
			echo "<td>无</td>";
		}
		else {
			echo "<td>有</td>";
		}
			
		echo "<td><input type='button' value='修改' onclick='gotoUpdateTopic(\"$setId\");'></input>";
		echo "<input type='button' value='删除' onclick='deleteSet($setId);'></input><td>";
		echo "</tr>";
	}
	?>
</table>
</body>
</html>
